package com.hzeport.bgs22emduty.inbound.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.assembly.hzeportIdem.annotaion.IdemAnnotation;
import com.hzeport.bgs22emduty.config.login.LoginCompoentService;
import com.hzeport.bgs22emduty.config.login.UserInfoDetailVO;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.service.BaseDeptInfoService;
import com.hzeport.bgs22emduty.service.DutyScheduleSetService;
import com.hzeport.bgs22emduty.vo.dudyScheduleSet.DudyScheduleSetListVO;
import com.hzeport.bgs22emduty.vo.dudyScheduleSet.DutyScheduleSetSaveVO;
import com.hzeport.bgs22emduty.vo.dudyScheduleSet.DutyScheduleSetZSSaveVO;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ${comments}
 *
 * @author code generator
 * @date 2022-12-02 11:21:59
 */
@RestController
@AllArgsConstructor
@RequestMapping(value = "/dudyScheduleSet")
@Api(value = "dudyScheduleSet", tags = "部门值班总表管理")
@Slf4j
public class DudyScheduleSetController {


    private final DutyScheduleSetService dutyScheduleSetService;

    @Resource
    private final LoginCompoentService loginCompoentService;
    /**
     * 分页查询
     *
     */
    @ApiOperation(value = "部门值班总表查询-月份情况查询", notes = "部门值班总表查询")
    @PostMapping("/dudyScheduleSetList")
    public BaseResult customsList(@RequestBody  DudyScheduleSetListVO dudyScheduleSetListVO) {
        return BaseResult.ok(dutyScheduleSetService.dudyScheduleSetList(dudyScheduleSetListVO));
    }
    /**
     * 分页查询
     *
     */
    @ApiOperation(value = "部门值班总表查询-排班记录", notes = "部门值班总表查询-排班记录")
    @GetMapping("/dutyRecord")
    public BaseResult dutyRecord(@RequestParam("customId")  String  customId) {
        return BaseResult.ok(dutyScheduleSetService.dutyRecord(customId));
    }

    /**
     * 分页查询
     * @return
     */
    @ApiOperation(value = "部门值班总表查询-月份情况-详情查询", notes = "部门值班总表查询-月份情况-详情查询")
    @GetMapping("/detail")
    public BaseResult detail(@RequestParam("id") String id
    ) {
        return BaseResult.ok(dutyScheduleSetService.detail(id));
    }



    /**N
     * 分页查询
     * @return
     */
    @ApiOperation(value = "部门值班总表查询-月份情况-重新初始化", notes = "部门值班总表查询-月份情况-重新初始化")
    @GetMapping("/reinit")
    public BaseResult reinit(@RequestParam("id") String id
    ) throws Exception {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return BaseResult.ok(dutyScheduleSetService.reinit(id,userInfoDetailVO));
    }

    /**
     * 分页查询
     * @return
     */
    @ApiOperation(value = "部门值班总表查询-月份情况保存", notes = "部门值班总表保存")
    @PostMapping("/save")
    @OperLog(systemName = "YJZB",description = "ZBBC")
    @IdemAnnotation
    public BaseResult save(@RequestBody DutyScheduleSetSaveVO dudyScheduleSetSaveVO) throws Exception {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return BaseResult.ok(dutyScheduleSetService.saveList(dudyScheduleSetSaveVO,userInfoDetailVO,false));
    }

    /**
     * 分页查询
     * @return
     */
    @ApiOperation(value = "部门值班总表查询-月份情况保存-总署", notes = "部门值班总表保存")
    @PostMapping("/saveZS")
    @OperLog(systemName = "YJZB",description = "ZBBC")
    @IdemAnnotation
    public BaseResult saveZS(@RequestBody DutyScheduleSetZSSaveVO dudyScheduleSetSaveVO) throws Exception {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return BaseResult.ok(dutyScheduleSetService.saveListZS(dudyScheduleSetSaveVO,userInfoDetailVO,false));
    }
    /**
     * 删除
     * @return
     */
    @ApiOperation(value = "删除")
    @OperLog(systemName = "YJZB",description = "ZBSC")
    @RequestMapping(value = "delete",method = RequestMethod.POST)
    public BaseResult removeById(@RequestParam("id") String id) {
        UserInfoDetailVO userInfoDetailVO=loginCompoentService.getUserInfo();
        return dutyScheduleSetService.delete(id,userInfoDetailVO);
    }


//    /**
//     * 分页查询
//     * @return
//     */
//    @ApiOperation(value = "部门值班总表查询", notes = "部门值班总表查询")
//    @GetMapping("/dudyScheduleSetList")
//    public BaseResult customsList(
//            @RequestParam("customId")String customId,@RequestParam("year")String year
//    ) {
//        return BaseResult.ok(dutyScheduleSetService.dudyScheduleSetList(customId,year));
//    }


}
